<?php

	header('X-Powered-By: Typhoon PHP Framework v1.0 (8th Generation)', true);

	$typhoon['start'] = '/index'; // Set default page: includes/pages/index.xml

	$_ = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $typhoon['start'];
	do
	{
		if (is_file('includes/pages' . $_ . '.xml'))
		{
			$typhoon['start'] = $_;
			break;
		}
		else if (is_file('includes/pages' . $_ . '.php'))
		{
			require('includes/pages' . $_ . '.php');
			exit;
		}
	} while ($_ = substr($_, 0, strrpos($_, '/')));

	$typhoon['xml'] = DOMDocument::load('includes/pages' . $typhoon['start'] . '.xml');
	require('includes/controllers/' . $typhoon['xml']->documentElement->getAttribute('start'));

